﻿using System;

namespace ContextualStateless
{
    /// <summary>
    /// Represents not null parameter enforcing functionality.
    /// </summary>
    static class Enforce
    {
        public static T ArgumentNotNull<T>(T argument, string description)
            where T : class
        {
            if (argument == null)
                throw new ArgumentNullException(description);

            return argument;
        }

        public static T ArgumentNotNull< T >( T argument )
            where T : class
        {
            if ( argument == null )
                throw new ArgumentNullException( typeof( T ).Name );

            return argument;
        }
    }
}
